package com.steakliu.sun.test;

/**
 * 功能说明：
 * <p>
 * Original @Author: steakliu-刘牌, 2023-02-06  14:16
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
public class ConcurrentVolatileTestKJ {

    private static volatile boolean flag = true;

    public static void main(String[] args) throws InterruptedException {
       new Thread(() -> {
           while (flag){
               System.out.println("------------------------");
           }
       }).start();
        System.out.println("--------start run-----------");
        //Thread.sleep(1);
        stop();
    }

    private static void stop(){
        flag = false;
    }
}
